<template>
       <el-container>
        <el-header >
          <div class="index_header">
            <div class="index_header_title">
            在线教育平台
          </div>
            <!--导航菜单开始-->
            <div class="index_header_menu">
                <el-menu background-color="#fff"  mode="horizontal" @select="handleSelect">
                    <el-menu-item index="1">首页</el-menu-item >
                    <el-menu-item index="2">上传视频</el-menu-item>
                    <el-menu-item index="3">后台管理</el-menu-item>
                </el-menu>
            </div>
            <div class="index_header_login" @click="login">
              登录/注册
          </div>
          </div>

          <el-divider></el-divider>
            <!--导航菜单结束-->
        </el-header>
        
        <el-main style="width: 1200px;margin: 0 auto">

            <el-row :gutter="20">
                <el-col :span="18">
                    <!--走马灯开始-->
                    <el-carousel trigger="click" height="500px">
                        <el-carousel-item >
                            <img src="../../assets/imgs/banner_0.jpg"  width="100%" alt="">
                        </el-carousel-item>
                        <el-carousel-item >
                            <img src="../../assets/imgs/banner_1.jpg"  width="100%" alt="">
                        </el-carousel-item>
                        <el-carousel-item >
                            <img src="../../assets/imgs/banner_2.jpg"  width="100%" alt="">
                        </el-carousel-item>
                        <el-carousel-item >
                            <img src="../../assets/imgs/banner_3.jpg"  width="100%" alt="">
                        </el-carousel-item>
                    </el-carousel>
                   
                    <!--走马灯结束-->
                </el-col>
                <el-col :span="6">
                    <!--排行榜开始-->
                    <el-card>
                        <h3>
                            <i style="font-weight: bold" class="el-icon-trophy"> 播放量排行榜</i>
                        </h3>
                        <el-divider></el-divider>
                        <el-table :data="topArr" height="380">
                            <el-table-column type="index" label="排名"></el-table-column>
                            <el-table-column prop="title" label="视频名称"></el-table-column>
                            <el-table-column prop="saleCount" label="播放量"></el-table-column>
                        </el-table>
                    </el-card> 
                    <!--排行榜结束-->
                </el-col>
            </el-row>

            <el-row :gutter="20" class="row_card" >
                <el-col :span="6" v-for="p in productArr"  @click="gotoVideo(p.id)" >
                    <el-card >
                        <img :src="p.url" width="100%" height="100">
                        <p style="font-size: 14px;height: 30px">{{p.title}}</p>
                        <p>
                            <b>￥{{p.price}}</b>
                            <s>{{p.oldPrice}}</s>
                            <span style="float: right">
                                销量:{{p.saleCount}}件</span>
                        </p>
                    </el-card>
                </el-col>
            </el-row>


        </el-main>
    </el-container>
</template>

  <script>
import { login } from '@/api/user';

  // import tp from '@/assets/imgs/banner'
  export default {
    filters: {

    },
    data() {
      return {
        list:4,
        productArr:[{title:"瑜伽服套装女固定胸垫防震跑步运动专业普拉提训练速干长袖气质健身衣",price:99,oldPrice:598,uri:"imgs/c2.png",saleCount:8000},
                        {title:"耐克 NIKE 男子 紧身服  运动服 DD1991-100 白色 M码",price:299,oldPrice:598,url:"imgs/c1.png",saleCount:6000},
                        {title:"康佑健 腿部按摩器滚轮 美腿夹环形 小腿按摩器",price:59,oldPrice:88,url:"imgs/b2.png",saleCount:3000},
                        {title:"尚官（SingleLady）腿部按摩器滚轮肌肉放松",price:49,oldPrice:99,url:"imgs/b1.png",saleCount:3000},
                        {title:"康比特SFMASS Pro增肌粉5磅 草莓味",price:588,oldPrice:988,url:"imgs/a2.png",saleCount:2342},
                        {title:"99%高含量乳清蛋白质粉",price:388,oldPrice:598,url:"imgs/a1.png",saleCount:2342},
                        {title:"鲨鱼菲特 全麦面包欧包 奶酪夹心无蔗糖",price:39,oldPrice:59,url:"imgs/d.png",saleCount:2342},
                        {title:"鲨鱼菲特（SHARKFIT） 五黑紫米欧包",price:39,oldPrice:59,url:"imgs/c.png",saleCount:2342},
                        {title:"舌里 全麦面包0脂肪无油无蔗糖",price:29,oldPrice:59,url:"imgs/a.png",saleCount:2342},
                        {title:"杜威克 飞力士棒 健身弹力菲利斯棒抖抖杆训练振动杆",price:29,oldPrice:59,url:"imgs/b3.png",saleCount:2342},
                        {title:"夹腿训练器盆底腿肌肉练大腿内侧瘦凯格臀锻炼部神男士尔器PC肌",price:29,oldPrice:59,url:"imgs/b4.png",saleCount:2342},
                        {title:"暴肌独角兽全麦面包欧包低脂",price:50,oldPrice:39,url:"imgs/b.png",saleCount:2342}],
        topArr:[{title:"良品铺子 黑麦全麦面包",saleCount:10000},
                        {title:"鲨鱼菲特 全麦面包欧包",saleCount:8000},
                        {title:"斯维诗 乳清蛋白粉香草味",saleCount:5506},
                        {title:"康比特 Pro增肌粉",saleCount:4800},
                        {title:"腿部按摩器滚轮肌肉放松",saleCount:3500},
                        {title:"耐克健身套装男",saleCount:3000}],
               
      }
    },
    created() {
     
    },
    methods: {
      handleSelect(val){
          console.log("val",val)
          
          if(val==3){
            this.$router.push('/admin/resourceManagement');
          }else if(val==2){
            this.$router.push('/video');
          }
         
      },

      login(){
        this.$router.push('/login');
      },

      gotoVideo(id){
        console.log(id)
        this.$router.push('/video');
      }
    }
  }
  </script>
  <style scoped>
        .el-header a{
            color: #666;
            text-decoration: none;
        }
        .el-menu.el-menu--horizontal{
            border-bottom: 0;
        }
        .el-table .el-table__cell{
            padding: 0;
        }
        .el-header{
          padding: 0px;
        }
        .index_header{
          padding: 0px;
          display: flex;
          width: 1200px;
          margin: 0 auto;
          
        }
        /deep/ .el-divider--horizontal{
          margin: 0px;
        }
        .index_header_menu{
          width: 880px;
          /* margin: 0 auto ; */
          font-size: 18px;
          color:"#fff" ;
          margin-left: 100px;
        }
        .index_header_title{
          font:italic bold 12px/30px Georgia,serif;
          font-size: 24px;
          text-align: center;
          line-height: 4rem;
        }
        .index_header_login{
          text-align: center;
          line-height: 4rem;
          font-size: 16px;
          float: right;
          cursor: pointer;
        }

        .row_card /deep/ .el-col ,.el-col-6{
            padding-bottom: 10px;
            cursor: pointer;
          }
</style>
  